<?php
require('../../../class/connect.php');
require('../../../class/db_sql.php');
$link=db_connect();
$empire=new mysqlquery();
$str = '';
if($_GET[enews]){
	if(file_exists('lock.off')){
		die('评论安装已锁定，请删除install目录下的lock.off再安装！');
	}
	if($_GET[enews]=='back')
	{
		$sql = $empire->query("DROP TABLE IF EXISTS `phome_enewspl_htf`;");
		if($sql)
		{
			echo "数据库phome_enewspl_htf删除成功，请到后台手动[<font color=red>更新数据库缓存</font>]";
		}
	}
	else
	{
		$sql = $empire->query("CREATE TABLE `phome_enewspl_htf` (
		  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
		  `p_id` int(11) unsigned DEFAULT '0' COMMENT '所属评论的id;默认0一级评论',
		  `a_id` int(10) unsigned NOT NULL COMMENT '文章id',
		  `c_id` int(10) unsigned NOT NULL COMMENT '分类id',
		  `tel` varchar(20) NOT NULL COMMENT '手机号',
		  `content` varchar(255) DEFAULT NULL COMMENT '评论内容',
		  `zan` int(10) unsigned DEFAULT '0' COMMENT '赞的次数',
		  `create_time` datetime DEFAULT NULL,
		  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
		  PRIMARY KEY (`id`),
		  KEY `p_id` (`p_id`),
		  KEY `a_id` (`a_id`),
		  KEY `c_id` (`c_id`)
		) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='好头发使用的评论表';");

		if($sql)
		{
			echo "安装成功，请到后台手动[<font color=red>更新数据库缓存</font>]";
		}
	}
	exit();
}
db_close();
$empire=null;
?>
<style type="text/css">
	a{color:#fff;display: inline-block;padding:5px;text-decoration: none}
	a:hover{text-decoration: underline;color:red;}
 </style>
<div style="width:400px;margin:100px auto;text-align:center;background:#555;color:#fff;padding:10px;border-radius:5px;box-shadow:1px 1px 3px #ccc">
	<h3 style="text-shadow:1px 1px 5px #00FF61">帝国cms好头发评论模块安装器</h3>
	<p>
		<a href="index.php?enews=install">安装</a>
		<a href="index.php?enews=back">还原</a>
	</p>
	<p><a href="http://www.520am.com" target="_blank"><font color=#ccc>ECMS之家出品</font></a></p>
	<p style="color:#8BC34A">帝国cms，想到即可做到！</p>
	<p style="font-size:12px;line-height:18px;text-align:left;padding:10px">注意：好头发网站使用！</p>
</div>

<div id="test">
	<div class="pl-520am" data-id="18187" data-classid="1"></div>
	<script type="text/javascript" src="../api.js"></script>
</div>
